import React from 'react';
import Child from "./Child";
import {Button} from 'antd';
import 'antd/dist/antd.css';
import './style.less';

export default class Life extends React.Component{
    constructor(props) {
        super(props);
        this.state = { count: 0 }
    }

    handleAdd = () => {
        this.setState({
            count: this.state.count + 1
        });
    };

    handleClick() {
        this.setState({
            count: this.state.count + 1
        });
    }

    render() {
        return <div className="content">
            <p>React生命周期介绍</p>
            <button onClick={this.handleAdd}>点击一</button>
            <button onClick={this.handleClick.bind(this)}>点击二</button>
            <p>{this.state.count}</p>
            <Child name={this.state.count}/>
            <Button type="primary" onClick={this.handleAdd}>waagagaga</Button>
        </div>
    }

}
